package com.lanlan.deploy;

import javax.annotation.Resource;
import javax.sql.DataSource;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ComponentScan;

/**
 * 
 * @ClassName: Application
 * @Description: 启动类
 * @author XGJ
 * @date 2022-10-13 10:09:11
 */
@SpringBootApplication
@ComponentScan(basePackages = { "com.lanlan.config" })
public class Application implements CommandLineRunner {

    private Logger logger = LoggerFactory.getLogger(Application.class);

    /**
     * 供应商数据源
     * 
     */
    @Resource(name = "vendorDataSource")
    private DataSource vendorDataSource;

    /**
     * 用户数据源
     */
    @Resource(name = "userDataSource")
    private DataSource userDataSource;

    public static void main(String[] args) {
	// 启动 Spring Boot 应用
	SpringApplication.run(Application.class, args);
    }

    /**
     * @Title: run
     * @Description: TODO(描述)
     * @param args
     * @throws Exception
     * @see org.springframework.boot.CommandLineRunner#run(java.lang.String[])
     * @author XGJ
     * @date 2022-10-13 03:55:12
     */
    @Override
    public void run(String... args) throws Exception {
	// orders 数据源
	logger.info("[run][获得数据源vendorDataSource：{}]", vendorDataSource.getClass());

	// users 数据源
	logger.info("[run][获得数据源userDataSource：{}]", userDataSource.getClass());
    }

}
